Merged
Conversation
Contributor
Author
|
This is a reduced subset of #2404 that only contains the attributes support without changing any functionality |
4 tasks
kdambekalns
approved these changes
Aug 2, 2021
Member
kdambekalns
left a comment
There was a problem hiding this comment.
Looks good by reading, I like how the annotation implementations get simpler!
Contributor
|
@albe - I also really like it ( as far as I understand it :) - would you take care of the failing psalm tests? |
skurfuerst
approved these changes
Aug 10, 2021
Member
skurfuerst
left a comment
There was a problem hiding this comment.
looks good by reading :) Great job! Instanciating annotations manually is a case I have never seen in the wild, so for me that's safe.
Contributor
Author
|
Regarding psalm, I guess we need to do a baseline update in master anyway before the release. I can take care on friday if it's not too late |
This was referenced Aug 11, 2021
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This allows to use all existing Annotations as PHP8 Attributes and makes the ReflectionService pick up attributes like annotations.
Hence all
is*AnnotatedWith()and*Annotation()methods will return attribute classes as if they were annotations.Note though, that this means a class that has both annotation and the equal attribute will behave as if all annotations were duplicated.
Also, in case you manually instanciated an Annotation class, you need to adjust to the changed constructor, which no longer takes a named array, but the list of actual properties.
In most cases instead of
new Flow\Inject($args)you can probably donew Flow\Inject(...$args)with PHP8 and named parameters.For Doctrine Annotations - see doctrine/orm#8266 which will be available with 2.9